#include "TrackedObject.hxx"

TrackedObject::TrackedObject()
{
    _objectId = -1;
    _startFrameIndex = -1;
    _endFrameIndex = -1;
    _classIndex = -1;
	_isSelected = false;
    _visible = true;
}

//void TrackedObject::pushRect(int frameIndex, cv::Rect2d rect)
//{
//    _boxes[frameIndex] = new ShapeRect(rect);
//}

void TrackedObject::pushShape(int frameIndex, Shape* shape)
{
    _boxes[frameIndex] = shape;
}

void TrackedObject::eraseRect(int frameIndex)
{
    _boxes.erase(frameIndex);
}

void TrackedObject::eraseShape(int frameIndex)
{
    _boxes.erase(frameIndex);
}

cv::Rect2d TrackedObject::getRect(int frameIndex)
{
    if (_boxes.find(frameIndex) != _boxes.end())
    {
        ShapeRect* shape = (ShapeRect*)_boxes[frameIndex];
        return shape->getRect();
    }
    else
        return cv::Rect2d(0, 0, 0, 0);
}

Shape* TrackedObject::getShape(int frameIndex) 
{ 
    if (_boxes.find(frameIndex) != _boxes.end()) 
        return _boxes[frameIndex]; 
    else 
        return 0; 
}